package com.zhanshen.service.impl;

import com.zhanshen.dao.FindDao;
import com.zhanshen.pojo.Find;
import com.zhanshen.pojo.Message;
import com.zhanshen.service.FindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;


@Service
public class FindServiceImpl implements FindService {
    @Autowired
    private FindDao findDao;

    @Override
    public int speak(Find find) {
//        Date date = new Date();
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
//        find.setFtime(simpleDateFormat.format(date));
        System.out.println(find.getFname());
        if (find.getFtext()==null&&find.getFname()==null){
            return 0;
        }
        find.setFtime(new Timestamp(new Date().getTime()));

        return findDao.speak(find);



    }


    @Override
    public List<Find> selectAll() {
        return findDao.selectAll();

    }

    @Override
    public Find select(String fname, String ftext) {
        return findDao.select(fname,ftext);
    }
}
